package org.ktjy.springbootch01.web;

import jakarta.annotation.Resource;
import org.ktjy.springbootch01.comm.RoomProperties;
import org.ktjy.springbootch01.service.HelloKtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloKtController {
    @Resource
    private RoomProperties roomProperties;

    @Autowired
    private HelloKtService helloKtService;

//    @GetMapping("/hello")
//    public String hello() {
//        return "老六";
//    }

    @RequestMapping("/hello")
    public String hello() {
        String msg = helloKtService.hello();
        msg +=  "学校的" + roomProperties.getTitle() + "是" + roomProperties.getAddr() + "里面有" + roomProperties.getCount() + "位同学";
        return msg;
    }

//    @PostMapping("/hello/post")
//    public String helloPost(@RequestParam String keyword) {
//        return keyword;
//    }

    @RequestMapping("/hello/post")
    public String helloPost(@RequestParam String keyword) {
        return keyword;
    }
}
